package org.example.spring_trans.service;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.example.spring_trans.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@Data
@Slf4j
@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;
    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public Integer registryUser(String name, String password){
        return userMapper.insert(name,password);

    }
}
